<template>
	<view>
		<view class="searchBox">
			<view class="search">
				<input type="text" placeholder="输入城市名、拼音或首字母查询">
				<u-icon name="search" color="#1C274C" size="28"></u-icon>
			</view>
		</view>
		<view class="citys">
			<u-index-list :index-list="indexList">
				<u-index-item>
					<u-index-anchor text="当前定位"></u-index-anchor>
				</u-index-item>
				<view @click="adressClick" class="list-cell">郑州</view>
				<u-index-item>
					<u-index-anchor text="热门城市"></u-index-anchor>
				</u-index-item>
				<view @click="adressClick1(item)" class="list-cell" v-for="(item,index) in popularCities" :key="index">{{item}}</view>
				<template v-for="(item, index) in itemArr">
					<!-- #ifdef APP-NVUE -->
					<u-index-anchor :text="indexList[index]"></u-index-anchor>
					<!-- #endif -->
					<u-index-item>
					<!-- #ifndef APP-NVUE -->
					<u-index-anchor :text="indexList[index]"></u-index-anchor>
					<!-- #endif -->
					<view class="list">
						<view @click="adressClick1(cell)" class="list-cell" v-for="(cell, index) in item">
							{{cell}}
						</view>
					</view>
					</u-index-item>
				</template>
			</u-index-list>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indexList: ["A", "B", "C","D", "E", "F","G", "H", "I"],
				itemArr: [
					['鞍山','鞍山','鞍山','鞍山','鞍山','鞍山','鞍山','鞍山'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
					['北京','北京','北京','北京','北京','北京'],
				],
				popularCities:['北京','上海','广州','深圳','杭州','南京',]
			};
		},
		methods:{
			adressClick(){
				uni.navigateBack()
			},
			adressClick1(item){
				
				// 获取所有页面栈实例列表
				let pages = getCurrentPages();  
				
				// 当前页页面实例
				let nowPage = pages[ pages.length - 1]; 
				 
				// 上一页页面实例
				let prevPage = pages[ pages.length - 2 ];  
				
				// 修改上一页data里面的times参数值为100
				let object = {
					myctiy:item
				};
				prevPage.$vm.prevDateFun(object) // 调用上一页 定义的方法
				
				//uni.navigateTo跳转的返回，默认1为返回上一级
				uni.navigateBack({  
				    delta: 1
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
page{
	background: #F7F7FA;
}
.searchBox{
	width: 750rpx;
	margin-top: 40rpx;
	.search{
		width: 686rpx;
		height: 83rpx;
		border-radius: 42rpx;
		border: 3rpx solid #1C274C;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 0 32rpx;
		margin: 0 auto ;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		input{
			margin-left:  30rpx;
		}
		.input-placeholder{
			font-size: 24rpx;
		}
	}
}
.list-cell {
	line-height: 80rpx;
	text-align: center;
	font-size: 28rpx;
	color: #1C274C;
	width: 170rpx;
	height: 80rpx;
	background: #FFFFFF;
	border-radius: 30rpx;
	display: inline-block;
	margin: 15rpx 36rpx;
}
.u-index-anchor{
	margin: 10rpx 0;
	background-color: #FFFFFF !important;
}
.citys{
	margin-top: 80rpx;
}
</style>
